home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / include / sys / stat.h < prev    next >
C/C++ Source or Header  |  1996-01-30  |  2KB  |  84 lines

  1. /* This is file STAT.H */
  2. /*
  3. ** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  4. **
  5. ** This file is distributed under the terms listed in the document
  6. ** "copying.dj", available from DJ Delorie at the address above.
  7. ** A copy of "copying.dj" should accompany this file; if not, a copy
  8. ** should be available from where this file was obtained.  This file
  9. ** may not be distributed without a verbatim copy of "copying.dj".
  10. **
  11. ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
  12. ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. */
  14.  
  15. #ifndef _STAT_H_
  16. #define _STAT_H_
  17.  
  18. /* This structure must match the one in go32, so it cannot change */
  19. struct  stat {
  20.         short st_dev;
  21.         short st_ino;
  22.         unsigned short st_mode;
  23.         short st_nlink;
  24.         short st_uid;
  25.         short st_gid;
  26.         short st_rdev;
  27.     short __alignment_filler;
  28.         long  st_size;
  29.         long  st_atime;
  30.         long  st_mtime;
  31.         long  st_ctime;
  32.         long  st_blksize;
  33. };
  34.  
  35. #define S_IFMT  0xF000  /* file type mask */
  36. #define S_IFDIR 0x4000  /* directory */
  37. #define S_IFFIFO 0x1000 /* FIFO special */
  38. #define S_IFIFO 0x1000 /* FIFO special */
  39. #define S_IFCHR 0x2000  /* character special */
  40. #define S_IFBLK 0x3000  /* block special */
  41. #define S_IFREG 0x8000  /* regular file */
  42.  
  43. #define S_IREAD        0400  /* owner may read */
  44. #define S_IWRITE    0200 /* owner may write */
  45. #define S_IEXEC        0100  /* owner may execute <directory search> */
  46.  
  47. #define S_IRUSR        0400
  48. #define S_IWUSR        0200
  49. #define S_IXUSR        0100
  50. #define S_IRWXU        0700
  51.  
  52. #define S_IRGRP        0040
  53. #define S_IWGRP        0020
  54. #define S_IXGRP        0010
  55. #define S_IRWXG        0070
  56.  
  57. #define S_IROTH        0004
  58. #define S_IWOTH        0002
  59. #define S_IXOTH        0001
  60. #define S_IRWXO        0007
  61.  
  62.  
  63. typedef unsigned short mode_t;
  64.  
  65. #define S_ISREG(x)      (((x) & S_IFMT) == S_IFREG)
  66. #define S_ISDIR(x)      (((x) & S_IFMT) == S_IFDIR)
  67. #define S_ISCHR(x)      (((x) & S_IFMT) == S_IFCHR)
  68. #define S_ISBLK(x)      (((x) & S_IFMT) == S_IFBLK)
  69. #define S_ISFIFO(x)     (((x) & S_IFMT) == S_IFFIFO)
  70.  
  71. #ifdef __cplusplus
  72. extern "C" {
  73. #endif
  74.  
  75. extern int (mkfifo) (const char *, mode_t);
  76. int stat(const char *, struct stat *);
  77. int fstat(int, struct stat *);
  78.  
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82.  
  83. #endif
  84.